package edu.pku.sei.act.ctrl.editpart;

import java.beans.PropertyChangeEvent;
import org.eclipse.draw2d.IFigure;
import edu.pku.sei.act.ctrl.figure.MoteForPackageFigure;
import edu.pku.sei.act.images.ArchiModelImageProvider;
import edu.pku.sei.act.model.mote.MoteForPackage;
import edu.pku.sei.gmp.controller.editpart.GMPNodeEditPart;

public class MoteForPackageEditPart extends GMPNodeEditPart{
	
	protected IFigure createFigure() {
		MoteForPackage mote = this.getMote();
		return new MoteForPackageFigure(mote.getName(),ArchiModelImageProvider.MOTELARGE);
	}

	public MoteForPackage getMote(){
		return (MoteForPackage)getModelElement();
	}
	public void handlePropertyChanged(PropertyChangeEvent event) {
		refreshVisuals();
		super.handlePropertyChanged(event);
	}

	protected void refreshVisuals() {
		MoteForPackage mote = this.getMote();
		((MoteForPackageFigure)figure).setName(mote.getName());
		super.refreshVisuals();
	}

}
